ausData <- read.csv("ausStudentData.csv")
canData <- read.csv("canStudentData.csv")

##############################################################################

### Number of participants ###

table(ausData$Q0) #109
table(canData$A2) #99

### Gender ###

table(ausData$Q1001C)
table(canData$Z1[canData$A2=="Doctoral student"])

### Age ###

table(ausData$Q1002C) #N = 84
table(ausData$Q1002C)[1:5]/84
summary(ausData$Q1002C[1:5])

ageSub <- subset(ausData,ausData$Q1002C != 97)
table(ageSub$Q1002C)

table(canData$Z2[canData$A2=="Doctoral student"])
canAge <- 2021 - canData$Z2[canData$A2=="Doctoral student"]
length(canAge)
#<30 = 1  7  3  8 10  8 = 37 0.393617
#30-39 = 8  8  7  7  4  6  4  1  5 = 50 0.5319149
#40-49 = 3 0.03191489
#50-59 = 1 1 = 2 0.0212766
#60+ = 1 1 = 2 0.0212766
#Total=94

## Age X Gender ##

prop.table(table(ausData$Q1002C,ausData$Q1001C)[1:5,1:2],1)

table(canAge,canData$Z1[canData$A2=="Doctoral student"])

### Study status ###

table(ausData$Q102C)
table(ausData$Q1001C, ausData$Q102C)
prop.table(table(ausData$Q1001C, ausData$Q102C), 1)
table(canData$A6[canData$A2=="Doctoral student"])
table(canData$Z1[canData$A2=="Doctoral student"],canData$A6[canData$A2=="Doctoral student"])
prop.table(table(canData$Z1[canData$A2=="Doctoral student"],canData$A6[canData$A2=="Doctoral student"]),1)

### Domestic status ###

table(ausData$Q1003C)
table(canData$A5[canData$A2=="Doctoral student"])

### Area of study ###

table(ausData$Q104C)
#Aus pol = 7
#Comparative = 27
#Theory = 8
#Pub pol = 5
#IR = 3 + 2 + 6 + 5 + 12 = 28
# Gender = 8
# Other = 9 + 14 = 23 (i.e. political sociology)
# Total = 107
table(ausData$Q1001C,ausData$Q104C)
prop.table(table(ausData$Q1001C,ausData$Q104C)[1:2,1:12], 1) #n=88

ausData$areaStudy7 <- ifelse(ausData$Q104C == 1,4,   #comparative politics
                             ifelse(ausData$Q104C == 2,1,   #political theory
                                    ifelse(ausData$Q104C == 4,3,   #Auspol
                                           ifelse(ausData$Q104C == 5,6,   #women's/gender studies
                                                  ifelse(ausData$Q104C == 6,5,   #Public policy
                                                         ifelse(ausData$Q104C == 7,2,   #IR
                                                                ifelse(ausData$Q104C == 8,2,
                                                                       ifelse(ausData$Q104C == 9,2,
                                                                              ifelse(ausData$Q104C == 10,2,
                                                                                     ifelse(ausData$Q104C == 11,2,
                                                                                            ifelse(ausData$Q104C == 12,7, #other
                                                                                                   ifelse(ausData$Q104C == 3,7,99))))))))))))   

table(ausData$areaStudy7)

table(canData$A4[canData$A2=="Doctoral student"])
#Total = 99
table(canData$Z1[canData$A2="Doctoral student"],canData$A4[canData$A2=="Doctoral student"])
prop.table(table(canData$Z1[canData$A2=="Doctoral student"],canData$A4[canData$A2=="Doctoral student"]),1)

### Group of Eight universities###

ausData$Go8 <- ifelse(ausData$Q108C == 6,1,
                      ifelse(ausData$Q108C == 8,1,
                             ifelse(ausData$Q108C == 15,1,
                                    ifelse(ausData$Q108C == 18,1,
                                           ifelse(ausData$Q108C == 24,1,
                                                  ifelse(ausData$Q108C == 31,1,
                                                         ifelse(ausData$Q108C == 35,1,
                                                                ifelse(ausData$Q108C == 38,1,0))))))))
table(ausData$Go8)


##############################################################################
### VIEWS ON ACADEMIA & BEYOND ###

# 1 Primarily interested in pursuing an academic career
table(canData$E1_A1[canData$A2=="Doctoral student"])
# Agree: 31 + 41 = 72 (72.7%)
# Neither: 15 (15.2%)
# Disagree: 4 + 8 = 12 (12.1%)
# Total: 99
table(canData$Z1[canData$A2=="Doctoral student"],canData$E1_A1[canData$A2=="Doctoral student"])
prop.table(table(canData$Z1[canData$A2=="Doctoral student"],canData$E1_A1[canData$A2=="Doctoral student"]),1)

table(ausData$Q202C_1)
# Agree: 47 (46.1%) 
# Neither: 33 (32.4%) 
# Disagree: 22 (21.6%) 
# Total: 102
prop.table(table(ausData$Q1001C,ausData$Q202C_1),1)

# 2 I measure my own success in terms of whether or not I successfully obtain an acadeimc position
table(canData$E1_A2[canData$A2=="Doctoral student"])
# Agree: 38 + 15 = 53 (53.5%)
# Neither: 13 (13.1%) 
# Disagree: 17 + 16 = 33 (33.3%)
# Total: 99
prop.table(table(canData$Z1[canData$A2=="Doctoral student"],canData$E1_A2[canData$A2=="Doctoral student"]),1)

table(ausData$Q202C_2)
# Agree: 21 0.2058824
# Neither: 34 0.3333333
# Disagree: 47 0.4607843
# Total: 102
prop.table(table(ausData$Q1001C,ausData$Q202C_2),1)

# 3 I was aware of limited job prospects...
table(canData$E1_A3[canData$A2=="Doctoral student"])
# Agree: 19 + 67 = 86 (86.9%)
# Neither: 4 (4.0%)
# Disagree: 7 + 2 = 9 (9.1%)
# Total: 99
prop.table(table(canData$Z1[canData$A2=="Doctoral student"],canData$E1_A3[canData$A2=="Doctoral student"]),1)

table(ausData$Q202C_3)
# Agree: 77 0.754902
# Neither: 10 0.09803922
# Disagree: 15 0.1470588
# Total: 102
prop.table(table(ausData$Q1001C,ausData$Q202C_3),1)

# 4 I am convinced that I will be successful in the academic job market...
table(canData$E1_A4[canData$A2=="Doctoral student"])
# Agree: 24+4 = 28 0.2857143
# Neither: 35 0.3571429
# Disagree: 19+16 = 35 0.3571429
# Total: 98
prop.table(table(canData$Z1[canData$A2=="Doctoral student"],canData$E1_A4[canData$A2=="Doctoral student"]),1)

table(ausData$Q202C_4)
# Agree: 16 0.1584158
# Neither: 48 0.4752475
# Disagree: 37 0.3663366
# Total: 101
prop.table(table(ausData$Q1001C,ausData$Q202C_4),1)

# 5 I feel I cannot quit my PhD program... time/money
table(canData$E1_A5[canData$A2=="Doctoral student"])
# Agree: 21+37 = 58 0.5918367
# Neither: 17 0.1734694
# Disagree: 13+10 = 23 0.2346939
# Total: 98
table(ausData$Q202C_5)
# Agree: 73 0.7156863
# Neither: 19 0.1862745
# Disagree: 10 0.09803922
# Total: 102

# 6 I feel I cannot quit my PhD program... embarassment
table(canData$E1_A6[canData$A2=="Doctoral student"])
# Agree: 27+26 = 53 0.5408163
# Neither: 17 0.1734694
# Disagree: 15+13 = 28 0.2857143
# Total: 98
table(ausData$Q202C_6)
# Agree: 51 0.5
# Neither: 32 0.3137255
# Disagree: 19 0.1862745
# Total: 102

# 7 I feel safe discussing non-academic career options with my supervisors
table(canData$E1_A7[canData$A2=="Doctoral student"])
# Agree: 29+36 = 65 0.6701031
# Neither: 17 0.1752577
# Disagree: 10+5 = 15 0.1546392
# Total: 97
table(ausData$Q202C_7)
# Agree: 59 0.5784314
# Neither: 26 0.254902
# Disagree: 17 0.1666667
# Total: 102

# 8 I would like more training for non-academic careers
table(canData$E1_A2[canData$A2=="Doctoral student"])
# Agree: 38+15 = 53 0.5353535
# Neither: 13 0.1313131
# Disagree: 17+16 = 33 0.3333333
# Total: 99
table(ausData$Q202C_8) 
# Agree: 63 0.6176471
# Neither: 22 0.2156863
# Disagree: 17 0.1666667
# Total: 102

##############################################################################
### DEVELOPMENT OPPORTUNITIES ###

# Have you engaged in the following activities...?

# Co-authoring
table(canData$I1_A1[canData$A2=="Doctoral student"])
# Y 40 0.5876289
# N 57 0.4123711
# Total: 97
prop.table(table(canData$Z1[canData$A2=="Doctoral student"],canData$I1_A1[canData$A2=="Doctoral student"]),1)

table(ausData$Q610C_1) 
# Y 20 0.3389831
# N 39
# Total: 59
table(ausData$Q1001C,ausData$Q610C_1)[1:2,] 
prop.table(table(ausData$Q1001C,ausData$Q610C_1)[1:2,],1)
table(ausData$Q1002C,ausData$Q610C_1)[1:5,] 
prop.table(table(ausData$Q1002C,ausData$Q610C_1)[1:5,],1)

# Included as co-investigator on grant app
table(canData$I1_A2[canData$A2=="Doctoral student"])
# Y 17 0.1770833
# N 79 
# Total: 96
prop.table(table(canData$Z1[canData$A2=="Doctoral student"],canData$I1_A2[canData$A2=="Doctoral student"]),1)

table(ausData$Q610C_2) 
# Y 5 0.08474576
# N 54
# Total: 59
prop.table(table(ausData$Q1001C,ausData$Q610C_2)[1:2,],1)

# Included for input on grant app
table(canData$I1_A3[canData$A2=="Doctoral student"])
# Y 24 0.25
# N 72 
# Total: 96
prop.table(table(canData$Z1[canData$A2=="Doctoral student"],canData$I1_A3[canData$A2=="Doctoral student"]),1)

table(ausData$Q610C_3) 
# Y 7 0.1186441
# N 52
# Total: 59
prop.table(table(ausData$Q1001C,ausData$Q610C_3)[1:2,],1)

# Employed as RA
table(canData$I1_A4[canData$A2=="Doctoral student"])
# Y 71 0.7395833
# N 25 
# Total: 96
prop.table(table(canData$Z1[canData$A2=="Doctoral student"],canData$I1_A4[canData$A2=="Doctoral student"]),1)

table(ausData$Q610C_4) 
# Y 27 0.4576271
# N 32
# Total: 59
prop.table(table(ausData$Q1001C,ausData$Q610C_4)[1:2,],1)

# Funding to attend conference
table(canData$I1_A5[canData$A2=="Doctoral student"])
# Y 42 0.4375
# N 54 
# Total: 96
prop.table(table(canData$Z1[canData$A2=="Doctoral student"],canData$I1_A5[canData$A2=="Doctoral student"]),1)

table(ausData$Q610C_5) 
# Y 8 0.1355932
# N 51
# Total: 59
prop.table(table(ausData$Q1001C,ausData$Q610C_5)[1:2,],1)

# Non-academic events
table(canData$I1_A6[canData$A2=="Doctoral student"])
# Y 47 0.4895833
# N 49 
# Total: 96
prop.table(table(canData$Z1[canData$A2=="Doctoral student"],canData$I1_A6[canData$A2=="Doctoral student"]),1)

table(ausData$Q610C_6) 
# Y 23 0.3898305
# N 36
# Total: 59
prop.table(table(ausData$Q1001C,ausData$Q610C_6)[1:2,],1)

##############################################################################
### AVAILABILITY OF CAREER TRAINING ###

# AUSTRALIA

# Sufficient training in the PhD program to prepare candidates for academic job market
table(ausData$Q707C)
#SD 16  D 20  N 11  A 21  SA 6  Total 84

# Sufficient training in the PhD program to prepare candidates for academic job market
table(ausData$Q707C)
#SD 16  D 20  N 11  A 21  SA 6  Total 84

#Optimistic of permanent academic position?
table(ausData$Q706C)
# Not confident: 35  0.6363636
# Moderately confident 14  0.2545455
# Very confident: 6 0.1090909
# Total: 55
table(ausData$Q1001C,ausData$Q706C)

# Supervisor's style of career mentoring?
table(ausData$Q601C)
# academic career 19 0.2087912
# academic and non-academic 20 0.2197802
# non-academic 1 0.01098901
# doesn't offer career mentoring 51 0.5604396
# Total: 91

# CANADA

# b1_a1 grad school improve career prospects
table(canData$B1_A1[canData$A2=="Doctoral student"])
#SD 2  D 5  N 5  A 55  SA 31 Don't know 1 Total 99

# b1_a3 anxious about future career
table(canData$B1_A3[canData$A2=="Doctoral student"])
#SD 2  D 8  N 6  A 29  SA 54 Total 99

# b1_a6 want more opps for careers skills training
table(canData$B1_A6[canData$A2=="Doctoral student"])
#SD 6  D 4  N 21  A 31  SA 35 Don't know 2 Total 99

# h1_a1 academic support from faculty
table(canData$H1_A1[canData$A2=="Doctoral student"])
# too little 31 0.3229167
# about right 34 0.3541667
# too much 2 0.02083333
# Not sure 29 0.3020833
# Total 96

# h1_a2 academic support from department
table(canData$H1_A2[canData$A2=="Doctoral student"])
# too little 35 0.3645833
# about right 41 0.4270833
# too much 3 0.03125
# Not sure 17 0.1770833
# Total 96

# h1_a3 non-academic support from faculty
table(canData$H1_A3[canData$A2=="Doctoral student"])
# too little 35 0.3645833
# about right 28 0.2916667
# too much 4 0.04166667
# Not sure 29 0.3020833
# Total 96

# h1_a4 non-academic support from department
table(canData$H1_A4[canData$A2=="Doctoral student"])
# too little 55 0.5729167
# about right 17 0.1770833
# too much 2 0.02083333
# Not sure 22 0.2291667
# Total 96

##############################################################################
### "primarily interested in academic career” ###
### BY “I am convinced I will be successful" ###

# Primarily interested in academic career - ausData$Q202C_1
# Convinced I will be successful - ausData$Q202C_4

# Primarily interested in academic career - canData$E1_A1[canData$A2=="Doctoral student"]
# Convinced I will be successful - canData$E1_A4[canData$A2=="Doctoral student"]

prop.table(table(canData$E1_A1[canData$A2=="Doctoral student"],canData$E1_A4[canData$A2=="Doctoral student"]))
prop.table(table(ausData$Q202C_1,ausData$Q202C_4),1)


### "measure my success” BY “I am convinced I will be successful" ###
# Measure my success: canData$E1_A2[canData$A2=="Doctoral student"]
# Convinced I will be successful: canData$E1_A4[canData$A2=="Doctoral student"]

table(canData$E1_A2[canData$A2=="Doctoral student"],canData$E1_A4[canData$A2=="Doctoral student"])
# Measure success: agree = 53; neither = 13; disagree = 33
prop.table(table(ausData$Q202C_2,ausData$Q202C_4),1)

# Age X Interest in pursuing academic career
prop.table(table(canData$Z2[canData$A2=="Doctoral student"],canData$E1_A1[canData$A2=="Doctoral student"]),1)
prop.table(table(ausData$Q1002C,ausData$Q202C_1),1) #n=88; 40+ = 26

# Age X Convinced I will be successful
prop.table(table(ausData$Q1002C,ausData$Q202C_4),1) #40+ = 26

# Program intensity X Interest in pursuing academic career
prop.table(table(canData$A6[canData$A2=="Doctoral student"],canData$E1_A1[canData$A2=="Doctoral student"]),1)
prop.table(table(ausData$Q102C,ausData$Q202C_1),1)

# Program intensity X Convinced I will be successful
prop.table(table(canData$A6[canData$A2=="Doctoral student"],canData$E1_A4[canData$A2=="Doctoral student"]),1)
prop.table(table(ausData$Q102C,ausData$Q202C_4),1)

